/*
 * @Author: Lizhenyu
 * @Date: 2021-07-07 16:52:52
 * @FilePath: \usp-osm-frondend\src\api\role.js
 */
import { service } from '@/utils/request'

const api = {
  getAllRole: '/admin/account/menu/menu-list',
  searchRole: '/admin/auth-rest/role/condition-all',
  modifyRole: '/admin/auth-rest/role/edit',
  searchSingleRole: '/admin/auth-rest/role',
  deleteRole: '/admin/role-2b/api/role/remove',
  changeStatus: '/admin/auth-rest/role/batch-status',
  synchronousRole: '/admin/account/role/bocRoleList',
  synchronousUser: '/admin/account/sysUser/bocUserList',
  getPositionInfo: '/admin/account/sysUser/boc-user-list ',
  checkPositionInfo: '/admin/account/sysUser/position-list',
  getAllDataRole: '/admin/account/menu/data-permission',
  getRoleInfo: '/admin/account/sysUser/role-list',
  editDataRoleSave: '/admin/account/menu/save-data-permission'
}

export function getAllRole (data) {
  return service({
    url: api.getAllRole,
    method: 'get',
    data
  })
}

export function searchRole (data) {
  return service({
    url: api.searchRole,
    method: 'post',
    data
  })
}

export function searchSingleRole (id) {
  return service({
    url: api.searchSingleRole + `/${id}`,
    method: 'get'
  })
}

export function editRoleSave (data) {
  return service({
    url: api.modifyRole,
    method: 'post',
    data
  })
}

export function deleteRole (data) {
  return service({
    url: api.deleteRole,
    method: 'post',
    data
  })
}

export function changeStatus (data) {
  return service({
    url: api.changeStatus,
    method: 'post',
    data
  })
}

export function synchronousRole (data) {
  return service({
    url: api.synchronousRole,
    method: 'post',
    data
  })
}

export function synchronousUser (data) {
  return service({
    url: api.synchronousUser,
    method: 'post',
    data
  })
}

export function getPositionInfo (data) {
  return service({
    url: api.getPositionInfo,
    method: 'post',
    data
  })
}

export function editDataRoleSave (data) {
  return service({
    url: api.editDataRoleSave,
    method: 'post',
    data
  })
}

export function getRoleInfo (id) {
  return service({
    url: api.getRoleInfo + `/${id}`,
    method: 'get'
  })
}

export function getAllDataRole (id) {
  return service({
    url: api.getAllDataRole + `/${id}`,
    method: 'get'
  })
}

export function checkPositionInfo (id) {
  return service({
    url: api.checkPositionInfo + `/${id}`,
    method: 'get'
  })
}
